<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li v-for="(item,index) in showList" :key="item.id" :class="{ completed: item.isDone }" >
      <div class="view">
        <input v-model="item.isDone" @click="checkLitter({suoyin:index,value:item.isDone})" class="toggle" type="checkbox" />
        <label>{{ item.name }}</label>
        <button @click="del(item.id)" class="destroy"></button>
      </div>
    </li>
  </ul>
</template>

<script>

import { mapState , mapMutations,mapGetters} from 'vuex'

export default {
  data(){
    return {

    }
  },
 mounted(){
 },
  computed:{
    ...mapState('TodoMain',['list']),
    ...mapGetters('TodoMain',['showList'])
    },
  methods: {
    ...mapMutations('TodoMain',['del']),
    ...mapMutations('TodoMain',['checkLitter'])
  }
}
</script>